home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / MathFFP.mod < prev    next >
Text File  |  1995-06-29  |  3KB  |  135 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: MathFFP.mod $
  4.   Description: Interface to mathffp.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. <* STANDARD- *>
  23.  
  24. MODULE [2] MathFFP;
  25.  
  26. IMPORT SYS := SYSTEM, Kernel, x := Exec;
  27.  
  28.  
  29. (*
  30. **      $VER: mathffp.h 36.2 (1.5.90)
  31. **
  32. **      general floating point declarations
  33. *)
  34.  
  35. CONST
  36.  
  37.   pi *       = 3.141592653589793;
  38.   twoPi *    = 6.283185307179586; (* Pi * 2.0 *)
  39.   pi2 *      = 1.570796326794696; (* Pi / 2.0 *)
  40.   pi4 *      = 0.785398163397448; (* Pi / 4.0 *)
  41.   e *        = 2.718281828459045;
  42.   log10 *    = 2.302585092994046;
  43.  
  44.   fpTen *    = 10.0;
  45.   fpOne *    = 1.0;
  46.   fpHalf *   = 0.5;
  47.   fpZero *   = 0.0;
  48.  
  49.  
  50. (*-- Library Base variable --------------------------------------------*)
  51.  
  52. CONST
  53.  
  54.   MathFFPName * = "mathffp.library";
  55.  
  56. VAR
  57.  
  58.   base * : x.LibraryPtr;
  59.  
  60.  
  61. (*-- Library Functions ------------------------------------------------*)
  62.  
  63. (*
  64. **      $VER: mathffp_protos.h 1.4 (3.5.90)
  65. *)
  66.  
  67. (*
  68.  *  There is no need to call any of these functions directly.  They are
  69.  *  called inline by the compiler when translating expressions
  70.  *  involving REAL values.  They are defined here for completeness.
  71.  *)
  72.  
  73. PROCEDURE Fix* [base,-30]
  74.   ( parm [0] : REAL )
  75.   : LONGINT;
  76. PROCEDURE Flt* [base,-36]
  77.   ( integer [0] : LONGINT )
  78.   : REAL;
  79. PROCEDURE Cmp* [base,-42]
  80.   ( leftParm  [1] : REAL;
  81.     rightParm [0] : REAL )
  82.   : LONGINT;
  83. PROCEDURE Tst* [base,-48]
  84.   ( parm [1] : REAL )
  85.   : LONGINT;
  86. PROCEDURE Abs* [base,-54]
  87.   ( parm [0] : REAL )
  88.   : REAL;
  89. PROCEDURE Neg* [base,-60]
  90.   ( parm [0] : REAL )
  91.   : REAL;
  92. PROCEDURE Add* [base,-66]
  93.   ( leftParm  [1] : REAL;
  94.     rightParm [0] : REAL )
  95.   : REAL;
  96. PROCEDURE Sub* [base,-72]
  97.   ( leftParm  [1] : REAL;
  98.     rightParm [0] : REAL )
  99.   : REAL;
  100. PROCEDURE Mul* [base,-78]
  101.   ( leftParm  [1] : REAL;
  102.     rightParm [0] : REAL )
  103.   : REAL;
  104. PROCEDURE Div* [base,-84]
  105.   ( leftParm  [1] : REAL;
  106.     rightParm [0] : REAL )
  107.   : REAL;
  108.  
  109. (* --- functions in V33 or higher (distributed as Release 1.2) ---*)
  110.  
  111. PROCEDURE Floor* [base,-90]
  112.   ( parm [0] : REAL )
  113.   : REAL;
  114. PROCEDURE Ceil* [base,-96]
  115.   ( parm [0] : REAL )
  116.   : REAL;
  117.  
  118.  
  119. (*-- Library Base variable --------------------------------------------*)
  120.  
  121. <*$LongVars-*>
  122.  
  123. (*-----------------------------------*)
  124. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  125.  
  126. BEGIN (* CloseLib *)
  127.   IF base # NIL THEN x.CloseLibrary (base) END
  128. END CloseLib;
  129.  
  130. BEGIN
  131.   base := x.OpenLibrary (MathFFPName, x.libraryMinimum);
  132.   IF base = NIL THEN HALT (100) END;
  133.   Kernel.SetCleanup (CloseLib)
  134. END MathFFP.
  135.